<!-- HTML header for doxygen 1.8.20-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=9"/>
	<meta name="generator" content="Doxygen 1.9.4"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>Raspberry Pi Pico SDK: include/pico/bootrom.h Source File</title>
	<!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="dynsections.js"></script>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
	<link href="doxygen.css" rel="stylesheet" type="text/css" />
	<link href="normalise.css" rel="stylesheet" type="text/css"/>
<link href="main.css" rel="stylesheet" type="text/css"/>
<link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
	<div class="navigation-mobile">
		<div class="logo--mobile">
			<a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
		</div>
		<div class="navigation-toggle">
			<span class="line-1"></span>
			<span class="line-2">
				<p>Menu Toggle</p>
			</span>
			<span class="line-3"></span>
		</div>
	</div>
	<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
		<div class="logo">
			<a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
			<span style="display: inline-block; margin-top: 10px;">
				v2.1.0
			</span>
		</div>
		<div class="navigation-footer">
			<img src="logo-mobile.svg" alt="Raspberry Pi">
			<a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
		</div>
<!-- 		<div class="search">
			<form>
				<input type="search" name="search" id="search" placeholder="Search">
				<input type="submit" value="Search">
			</form>
		</div> -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('bootrom_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">bootrom.h</div></div>
</div><!--header-->
<div class="contents">
<a href="bootrom_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">/*</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="comment"> * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="comment"> *</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="comment"> * SPDX-License-Identifier: BSD-3-Clause</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="comment"> */</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span><span class="preprocessor">#ifndef _PICO_BOOTROM_H</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#define _PICO_BOOTROM_H</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &quot;<a class="code" href="pico_8h.html">pico.h</a>&quot;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &quot;pico/bootrom_constants.h&quot;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span> </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span><span class="preprocessor">#ifndef __ASSEMBLER__</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#include &quot;pico/bootrom/lock.h&quot;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="preprocessor">#include &quot;<a class="code" href="pico__flash_2include_2pico_2flash_8h.html">pico/flash.h</a>&quot;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="comment">// ROM FUNCTION SIGNATURES</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span> </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span><span class="preprocessor">#if PICO_RP2040</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno">   27</span><span class="keyword">typedef</span> uint32_t (*rom_popcount32_fn)(uint32_t);</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span><span class="keyword">typedef</span> uint32_t (*rom_reverse32_fn)(uint32_t);</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span><span class="keyword">typedef</span> uint32_t (*rom_clz32_fn)(uint32_t);</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span><span class="keyword">typedef</span> uint32_t (*rom_ctz32_fn)(uint32_t);</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span><span class="keyword">typedef</span> uint8_t *(*rom_memset_fn)(uint8_t *, uint8_t, uint32_t);</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span><span class="keyword">typedef</span> uint32_t *(*rom_memset4_fn)(uint32_t *, uint8_t, uint32_t);</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span><span class="keyword">typedef</span> uint32_t *(*rom_memcpy_fn)(uint8_t *, <span class="keyword">const</span> uint8_t *, uint32_t);</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span><span class="keyword">typedef</span> uint32_t *(*rom_memcpy44_fn)(uint32_t *, <span class="keyword">const</span> uint32_t *, uint32_t);</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span><span class="keyword">typedef</span> <span class="keywordtype">void</span> __attribute__((noreturn)) (*rom_reset_usb_boot_fn)(uint32_t, uint32_t);</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span><span class="keyword">typedef</span> int (*rom_reboot_fn)(uint32_t flags, uint32_t delay_ms, uint32_t p0, uint32_t p1);</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span><span class="keyword">typedef</span> rom_reset_usb_boot_fn reset_usb_boot_fn; <span class="comment">// kept for backwards compatibility</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span><span class="keyword">typedef</span> void (*rom_connect_internal_flash_fn)(void);</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span><span class="keyword">typedef</span> void (*rom_flash_exit_xip_fn)(void);</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span><span class="keyword">typedef</span> void (*rom_flash_range_erase_fn)(uint32_t, size_t, uint32_t, uint8_t);</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span><span class="keyword">typedef</span> void (*rom_flash_range_program_fn)(uint32_t, <span class="keyword">const</span> uint8_t*, size_t);</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span><span class="keyword">typedef</span> void (*rom_flash_flush_cache_fn)(void);</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span><span class="keyword">typedef</span> void (*rom_flash_enter_cmd_xip_fn)(void);</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span><span class="preprocessor">#if !PICO_RP2040</span></div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span><span class="keyword">typedef</span> void (*rom_bootrom_state_reset_fn)(uint32_t flags);</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span><span class="keyword">typedef</span> void (*rom_flash_reset_address_trans_fn)(void);</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span><span class="keyword">typedef</span> void (*rom_flash_select_xip_read_mode_fn)(bootrom_xip_mode_t mode, uint8_t clkdiv);</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span><span class="keyword">typedef</span> int (*rom_get_sys_info_fn)(uint32_t *out_buffer, uint32_t out_buffer_word_size, uint32_t flags);</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span><span class="keyword">typedef</span> int (*rom_get_partition_table_info_fn)(uint32_t *out_buffer, uint32_t out_buffer_word_size, uint32_t partition_and_flags);</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span><span class="keyword">typedef</span> int (*rom_explicit_buy_fn)(uint8_t *buffer, uint32_t buffer_size);</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span><span class="keyword">typedef</span> <span class="keywordtype">void</span>* (*rom_validate_ns_buffer_fn)(<span class="keyword">const</span> <span class="keywordtype">void</span> *addr, uint32_t size, uint32_t write, uint32_t *ok);</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span><span class="keyword">typedef</span> intptr_t (*rom_set_rom_callback_fn)(uint callback_num, bootrom_api_callback_generic_t funcptr);</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span><span class="keyword">typedef</span> int (*rom_chain_image_fn)(uint8_t *workarea_base, uint32_t workarea_size, uint32_t window_base, uint32_t window_size);</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span><span class="keyword">typedef</span> int (*rom_load_partition_table_fn)(uint8_t *workarea_base, uint32_t workarea_size, <span class="keywordtype">bool</span> force_reload);</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span><span class="keyword">typedef</span> int (*rom_pick_ab_partition_fn)(uint8_t *workarea_base, uint32_t workarea_size, uint partition_a_num, uint32_t flash_update_boot_window_base);</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span><span class="keyword">typedef</span> int (*rom_get_b_partition_fn)(uint pi_a);</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span><span class="keyword">typedef</span> int (*rom_get_uf2_target_partition_fn)(uint8_t *workarea_base, uint32_t workarea_size, uint32_t family_id, <a class="code hl_struct" href="structresident__partition__t.html">resident_partition_t</a> *partition_out);</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span><span class="keyword">typedef</span> int (*rom_func_otp_access_fn)(uint8_t *buf, uint32_t buf_len, <a class="code hl_struct" href="structotp__cmd.html">otp_cmd_t</a> cmd);</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span><span class="comment">// Apply the address translation currently specified in QMI_ATRANSx (&quot;rolling window&quot; hardware</span></div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span><span class="comment">// translation). Need to take care using this on the boot path, as the QMI may not yet have been</span></div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span><span class="comment">// set up, but this should be suitable for translating system bus addresses into flash storage</span></div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span><span class="comment">// addresses in user callbacks. Returns all-ones for an invalid address, which is also an invalid</span></div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span><span class="comment">// flash storage address, so invalidity is propagated.</span></div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span><span class="keyword">typedef</span> intptr_t (*rom_flash_runtime_to_storage_addr_fn)(uintptr_t flash_runtime_addr);</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span><span class="comment">// Perform the specified erase/program/read operation, translating addresses according to</span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span><span class="comment">// QMI_ATRANSx if necessary, and checking flash permissions based on the resident partition table</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span><span class="comment">// and the specified effective security level. `addr` may be either a flash runtime address or a</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span><span class="comment">// flash storage address, depending on the ASPACE given in `flags`.</span></div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span><span class="comment">//</span></div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span><span class="comment">// NOTE: This function does not validate the buffer for NS access. This must be validated before</span></div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span><span class="comment">// calling if the caller is reachable from a Secure Gateway.</span></div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span><span class="keyword">typedef</span> int (*rom_flash_op_fn)(<a class="code hl_struct" href="structcflash__flags.html">cflash_flags_t</a> flags, uintptr_t addr, uint32_t size_bytes, uint8_t *buf);</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span><span class="preprocessor">#ifndef __riscv</span></div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span><span class="keyword">typedef</span> int (*rom_set_ns_api_permission_fn)(uint ns_api_num, <span class="keywordtype">bool</span> allowed);</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span><span class="keyword">typedef</span> int (*rom_func_secure_call)(uintptr_t a0, ...);</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span> </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span><span class="preprocessor">#ifdef __riscv</span></div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span>    uint32_t *base;</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>    uint32_t size;</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>} bootrom_stack_t;</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span><span class="comment">// passed in, and out.</span></div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span><span class="keyword">typedef</span> int (*rom_set_bootrom_stack_fn)(bootrom_stack_t *stack);</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno">  105</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno">  106</span> </div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno">  107</span><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span> </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga2b6dcf9d9c60d54a222f7c259c76b4b4">  120</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code hl_function" href="group__pico__bootrom.html#ga2b6dcf9d9c60d54a222f7c259c76b4b4">rom_table_code</a>(uint8_t c1, uint8_t c2) {</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno">  121</span>    <span class="keywordflow">return</span> <a class="code hl_define" href="group__pico__bootrom.html#ga5b3c93cbab0054e9938f2aca7261a73e">ROM_TABLE_CODE</a>((uint32_t) c1, (uint32_t) c2);</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span>}</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span> </div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno">  130</span><span class="keywordtype">void</span> *<a class="code hl_function" href="group__pico__bootrom.html#gaaaf61234f389da6444b6479f29616d7d">rom_func_lookup</a>(uint32_t code);</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno">  131</span> </div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span><span class="keywordtype">void</span> *<a class="code hl_function" href="group__pico__bootrom.html#gad3e66e7bcbf0448a0a63cf37dfb4b53c">rom_data_lookup</a>(uint32_t code);</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span> </div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno">  151</span><span class="keywordtype">bool</span> <a class="code hl_function" href="group__pico__bootrom.html#ga31965209f0ddaeaecaeb3c516abda04d">rom_funcs_lookup</a>(uint32_t *table, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count);</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span> </div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span><span class="comment">// Bootrom function: rom_table_lookup</span></div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno">  154</span><span class="comment">// Returns the 32 bit pointer into the ROM if found or NULL otherwise.</span></div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno">  155</span><span class="preprocessor">#if PICO_RP2040</span></div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno">  156</span><span class="keyword">typedef</span> <span class="keywordtype">void</span> *(*rom_table_lookup_fn)(uint16_t *table, uint32_t code);</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno">  157</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno">  158</span><span class="keyword">typedef</span> <span class="keywordtype">void</span> *(*rom_table_lookup_fn)(uint32_t code, uint32_t mask);</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno">  159</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno">  160</span> </div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno">  161</span><span class="preprocessor">#if PICO_C_COMPILER_IS_GNU &amp;&amp; (__GNUC__ &gt;= 12)</span></div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno">  162</span><span class="comment">// Convert a 16 bit pointer stored at the given rom address into a 32 bit pointer</span></div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno">  163</span><a class="code hl_define" href="group__pico__platform.html#ga23eadd8d1642fb8fe4600708c36e116a">__force_inline</a> <span class="keyword">static</span> <span class="keywordtype">void</span> *rom_hword_as_ptr(uint16_t rom_address) {</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno">  164</span><span class="preprocessor">#pragma GCC diagnostic push</span></div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno">  165</span><span class="preprocessor">#pragma GCC diagnostic ignored &quot;-Warray-bounds&quot;</span></div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno">  166</span>    <span class="keywordflow">return</span> (<span class="keywordtype">void</span> *)(uintptr_t)*(uint16_t *)(uintptr_t)rom_address;</div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span><span class="preprocessor">#pragma GCC diagnostic pop</span></div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno">  168</span>}</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno">  169</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno">  170</span><span class="comment">// Convert a 16 bit pointer stored at the given rom address into a 32 bit pointer</span></div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span><span class="preprocessor">#define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)(uintptr_t)(rom_address))</span></div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno">  173</span> </div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno">  174</span><span class="preprocessor">#ifdef __riscv</span></div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno">  175</span><span class="keyword">static</span> <a class="code hl_define" href="group__pico__platform.html#ga23eadd8d1642fb8fe4600708c36e116a">__force_inline</a> <span class="keywordtype">bool</span> rom_size_is_64k(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno">  176</span><span class="preprocessor">#ifdef RASPBERRYPI_AMETHYST_FPGA</span></div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno">  177</span>    <span class="keywordflow">return</span> *(uint16_t*)0x14 &gt;= 0x8000;</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno">  179</span>    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno">  180</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno">  181</span>}</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno">  182</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno">  183</span> </div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno">  190</span><span class="preprocessor">#pragma GCC diagnostic push</span></div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno">  191</span><span class="comment">// diagnostic: GCC thinks near-zero value is a null pointer member access, but it&#39;s not</span></div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno">  192</span><span class="preprocessor">#pragma GCC diagnostic ignored &quot;-Warray-bounds&quot;</span></div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">  193</a></span><span class="keyword">static</span> <a class="code hl_define" href="group__pico__platform.html#ga23eadd8d1642fb8fe4600708c36e116a">__force_inline</a> <span class="keywordtype">void</span> *<a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(uint32_t code) {</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno">  194</span><span class="preprocessor">#if PICO_RP2040</span></div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno">  195</span>    rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(BOOTROM_TABLE_LOOKUP_OFFSET);</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno">  196</span>    uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(BOOTROM_FUNC_TABLE_OFFSET);</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno">  197</span>    <span class="keywordflow">return</span> rom_table_lookup(func_table, code);</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno">  198</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno">  199</span><span class="preprocessor">#ifdef __riscv</span></div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno">  200</span>    uint32_t rom_offset_adjust = rom_size_is_64k() ? 32 * 1024 : 0;</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno">  201</span>    <span class="comment">// on RISC-V the code (a jmp) is actually embedded in the table</span></div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno">  202</span>    rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) (uintptr_t)*(uint16_t*)(BOOTROM_TABLE_LOOKUP_ENTRY_OFFSET + rom_offset_adjust);</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno">  203</span>    <span class="keywordflow">return</span> rom_table_lookup(code, RT_FLAG_FUNC_RISCV);</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno">  204</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno">  205</span>    <span class="comment">// on ARM the function pointer is stored in the table, so we dereference it</span></div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno">  206</span>    <span class="comment">// via lookup() rather than lookup_entry()</span></div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno">  207</span>    rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) (uintptr_t)*(uint16_t*)(BOOTROM_TABLE_LOOKUP_OFFSET);</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno">  208</span>    <span class="keywordflow">if</span> (<a class="code hl_function" href="group__pico__platform.html#ga66edd7569f5a42b0a2da43a5926cf064">pico_processor_state_is_nonsecure</a>()) {</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno">  209</span>        <span class="keywordflow">return</span> rom_table_lookup(code, RT_FLAG_FUNC_ARM_NONSEC);</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno">  210</span>    } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno">  211</span>        <span class="keywordflow">return</span> rom_table_lookup(code, RT_FLAG_FUNC_ARM_SEC);</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno">  212</span>    }</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno">  213</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno">  214</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno">  215</span>}</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno">  216</span><span class="preprocessor">#pragma GCC diagnostic pop</span></div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno">  217</span> </div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno">  235</span><span class="keywordtype">void</span> __attribute__((noreturn)) <a class="code hl_function" href="group__pico__bootrom.html#ga1bbe1c1df02daaa7b68a0c95fb9dc545">rom_reset_usb_boot</a>(uint32_t usb_activity_gpio_pin_mask, uint32_t disable_interface_mask);</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno">  236</span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __attribute__((noreturn)) reset_usb_boot(uint32_t usb_activity_gpio_pin_mask, uint32_t disable_interface_mask) {</div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno">  237</span>    <a class="code hl_function" href="group__pico__bootrom.html#ga1bbe1c1df02daaa7b68a0c95fb9dc545">rom_reset_usb_boot</a>(usb_activity_gpio_pin_mask, disable_interface_mask);</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno">  238</span>}</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno">  239</span> </div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno">  257</span><span class="keywordtype">void</span> __attribute__((noreturn)) <a class="code hl_function" href="group__pico__bootrom.html#gaef5ef9e40f0b55d3e9d6b4ddd6c1b8ee">rom_reset_usb_boot_extra</a>(<span class="keywordtype">int</span> usb_activity_gpio_pin, uint32_t disable_interface_mask, <span class="keywordtype">bool</span> usb_activity_gpio_pin_active_low);</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno">  258</span> </div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga3ba1206778b333958c0dae5582d53bc3">  271</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#ga3ba1206778b333958c0dae5582d53bc3">rom_connect_internal_flash</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno">  272</span>    rom_connect_internal_flash_fn func = (rom_connect_internal_flash_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_CONNECT_INTERNAL_FLASH);</div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno">  273</span>    func();</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno">  274</span>}</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno">  275</span> </div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga41206eddaf67511768746b947b9c47f6">  302</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#ga41206eddaf67511768746b947b9c47f6">rom_flash_exit_xip</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno">  303</span>    rom_flash_exit_xip_fn func = (rom_flash_exit_xip_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_EXIT_XIP);</div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno">  304</span>    func();</div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno">  305</span>}</div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno">  306</span> </div>
<div class="line"><a id="l00338" name="l00338"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gad2a854a04f7007e9e5efa67fe8887cd7">  338</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#gad2a854a04f7007e9e5efa67fe8887cd7">rom_flash_range_erase</a>(uint32_t addr, <span class="keywordtype">size_t</span> count, uint32_t block_size, uint8_t block_cmd) {</div>
<div class="line"><a id="l00339" name="l00339"></a><span class="lineno">  339</span>    rom_flash_range_erase_fn func = (rom_flash_range_erase_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_RANGE_ERASE);</div>
<div class="line"><a id="l00340" name="l00340"></a><span class="lineno">  340</span>    func(addr, count, block_size, block_cmd);</div>
<div class="line"><a id="l00341" name="l00341"></a><span class="lineno">  341</span>}</div>
<div class="line"><a id="l00342" name="l00342"></a><span class="lineno">  342</span> </div>
<div class="line"><a id="l00363" name="l00363"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga7fd2af8eea3dbd7bc76ed3306186ccef">  363</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#ga7fd2af8eea3dbd7bc76ed3306186ccef">rom_flash_range_program</a>(uint32_t addr, <span class="keyword">const</span> uint8_t *data, <span class="keywordtype">size_t</span> count) {</div>
<div class="line"><a id="l00364" name="l00364"></a><span class="lineno">  364</span>    rom_flash_range_program_fn func = (rom_flash_range_program_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_RANGE_PROGRAM);</div>
<div class="line"><a id="l00365" name="l00365"></a><span class="lineno">  365</span>    func(addr, data, count);</div>
<div class="line"><a id="l00366" name="l00366"></a><span class="lineno">  366</span>}</div>
<div class="line"><a id="l00367" name="l00367"></a><span class="lineno">  367</span> </div>
<div class="line"><a id="l00385" name="l00385"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga15e12479af4b4618e254065371779e1e">  385</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#ga15e12479af4b4618e254065371779e1e">rom_flash_flush_cache</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00386" name="l00386"></a><span class="lineno">  386</span>    rom_flash_flush_cache_fn func = (rom_flash_flush_cache_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_FLUSH_CACHE);</div>
<div class="line"><a id="l00387" name="l00387"></a><span class="lineno">  387</span>    func();</div>
<div class="line"><a id="l00388" name="l00388"></a><span class="lineno">  388</span>}</div>
<div class="line"><a id="l00389" name="l00389"></a><span class="lineno">  389</span> </div>
<div class="line"><a id="l00401" name="l00401"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga44ddf78266c92f7a486712b87a695b45">  401</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#ga44ddf78266c92f7a486712b87a695b45">rom_flash_enter_cmd_xip</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00402" name="l00402"></a><span class="lineno">  402</span>    rom_flash_enter_cmd_xip_fn func = (rom_flash_enter_cmd_xip_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_ENTER_CMD_XIP);</div>
<div class="line"><a id="l00403" name="l00403"></a><span class="lineno">  403</span>    func();</div>
<div class="line"><a id="l00404" name="l00404"></a><span class="lineno">  404</span>}</div>
<div class="line"><a id="l00405" name="l00405"></a><span class="lineno">  405</span> </div>
<div class="line"><a id="l00406" name="l00406"></a><span class="lineno">  406</span><span class="preprocessor">#if !PICO_RP2040 || PICO_COMBINED_DOCS</span></div>
<div class="line"><a id="l00407" name="l00407"></a><span class="lineno">  407</span><span class="preprocessor">#ifdef __riscv</span></div>
<div class="line"><a id="l00424" name="l00424"></a><span class="lineno">  424</span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> rom_set_bootrom_stack(bootrom_stack_t *stack) {</div>
<div class="line"><a id="l00425" name="l00425"></a><span class="lineno">  425</span>    rom_set_bootrom_stack_fn func = (rom_set_bootrom_stack_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_SET_BOOTROM_STACK);</div>
<div class="line"><a id="l00426" name="l00426"></a><span class="lineno">  426</span>    <span class="keywordflow">return</span> func(stack);</div>
<div class="line"><a id="l00427" name="l00427"></a><span class="lineno">  427</span>}</div>
<div class="line"><a id="l00428" name="l00428"></a><span class="lineno">  428</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00429" name="l00429"></a><span class="lineno">  429</span> </div>
<div class="line"><a id="l00476" name="l00476"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gadbb1f51a04fd0c27513468996d24f3ce">  476</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#gadbb1f51a04fd0c27513468996d24f3ce">rom_reboot</a>(uint32_t flags, uint32_t delay_ms, uint32_t p0, uint32_t p1) {</div>
<div class="line"><a id="l00477" name="l00477"></a><span class="lineno">  477</span>    rom_reboot_fn func = (rom_reboot_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_REBOOT);</div>
<div class="line"><a id="l00478" name="l00478"></a><span class="lineno">  478</span>    <span class="keywordflow">return</span> func(flags, delay_ms, p0, p1);</div>
<div class="line"><a id="l00479" name="l00479"></a><span class="lineno">  479</span>}</div>
<div class="line"><a id="l00480" name="l00480"></a><span class="lineno">  480</span> </div>
<div class="line"><a id="l00481" name="l00481"></a><span class="lineno">  481</span><span class="keywordtype">bool</span> rom_get_boot_random(uint32_t out[4]);</div>
<div class="line"><a id="l00482" name="l00482"></a><span class="lineno">  482</span> </div>
<div class="line"><a id="l00507" name="l00507"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga5067c3bfdb2dc2a08b6e84b40281cabd">  507</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#ga5067c3bfdb2dc2a08b6e84b40281cabd">rom_bootrom_state_reset</a>(uint32_t flags) {</div>
<div class="line"><a id="l00508" name="l00508"></a><span class="lineno">  508</span>    rom_bootrom_state_reset_fn func = (rom_bootrom_state_reset_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_BOOTROM_STATE_RESET);</div>
<div class="line"><a id="l00509" name="l00509"></a><span class="lineno">  509</span>    <span class="keywordflow">return</span> func(flags);</div>
<div class="line"><a id="l00510" name="l00510"></a><span class="lineno">  510</span>}</div>
<div class="line"><a id="l00511" name="l00511"></a><span class="lineno">  511</span> </div>
<div class="line"><a id="l00520" name="l00520"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga6990622d9a728e7e35f34c9c76fc11aa">  520</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#ga6990622d9a728e7e35f34c9c76fc11aa">rom_flash_reset_address_trans</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00521" name="l00521"></a><span class="lineno">  521</span>    rom_flash_reset_address_trans_fn func = (rom_flash_reset_address_trans_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_RESET_ADDRESS_TRANS);</div>
<div class="line"><a id="l00522" name="l00522"></a><span class="lineno">  522</span>    func();</div>
<div class="line"><a id="l00523" name="l00523"></a><span class="lineno">  523</span>}</div>
<div class="line"><a id="l00524" name="l00524"></a><span class="lineno">  524</span> </div>
<div class="line"><a id="l00535" name="l00535"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gab82d162f5e7bc5287d81ac4127e37541">  535</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__bootrom.html#gab82d162f5e7bc5287d81ac4127e37541">rom_flash_select_xip_read_mode</a>(bootrom_xip_mode_t mode, uint8_t clkdiv) {</div>
<div class="line"><a id="l00536" name="l00536"></a><span class="lineno">  536</span>    rom_flash_select_xip_read_mode_fn func = (rom_flash_select_xip_read_mode_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_SELECT_XIP_READ_MODE);</div>
<div class="line"><a id="l00537" name="l00537"></a><span class="lineno">  537</span>    func(mode, clkdiv);</div>
<div class="line"><a id="l00538" name="l00538"></a><span class="lineno">  538</span>}</div>
<div class="line"><a id="l00539" name="l00539"></a><span class="lineno">  539</span> </div>
<div class="line"><a id="l00540" name="l00540"></a><span class="lineno"><a class="line" href="structrom__helper__flash__op__params__t.html">  540</a></span><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a id="l00541" name="l00541"></a><span class="lineno">  541</span>    <a class="code hl_struct" href="structcflash__flags.html">cflash_flags_t</a> flags;</div>
<div class="line"><a id="l00542" name="l00542"></a><span class="lineno">  542</span>    uintptr_t addr;</div>
<div class="line"><a id="l00543" name="l00543"></a><span class="lineno">  543</span>    uint32_t size_bytes;</div>
<div class="line"><a id="l00544" name="l00544"></a><span class="lineno">  544</span>    uint8_t *buf;</div>
<div class="line"><a id="l00545" name="l00545"></a><span class="lineno">  545</span>    <span class="keywordtype">int</span> *res;</div>
<div class="line"><a id="l00546" name="l00546"></a><span class="lineno">  546</span>} <a class="code hl_struct" href="structrom__helper__flash__op__params__t.html">rom_helper_flash_op_params_t</a>;</div>
<div class="line"><a id="l00547" name="l00547"></a><span class="lineno">  547</span> </div>
<div class="line"><a id="l00548" name="l00548"></a><span class="lineno">  548</span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> rom_helper_flash_op(<span class="keywordtype">void</span> *param) {</div>
<div class="line"><a id="l00549" name="l00549"></a><span class="lineno">  549</span>    <span class="keyword">const</span> <a class="code hl_struct" href="structrom__helper__flash__op__params__t.html">rom_helper_flash_op_params_t</a> *op = (<span class="keyword">const</span> <a class="code hl_struct" href="structrom__helper__flash__op__params__t.html">rom_helper_flash_op_params_t</a> *)param;</div>
<div class="line"><a id="l00550" name="l00550"></a><span class="lineno">  550</span>    rom_flash_op_fn func = (rom_flash_op_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_OP);</div>
<div class="line"><a id="l00551" name="l00551"></a><span class="lineno">  551</span>    *(op-&gt;res) = func(op-&gt;flags, op-&gt;addr, op-&gt;size_bytes, op-&gt;buf);</div>
<div class="line"><a id="l00552" name="l00552"></a><span class="lineno">  552</span>}</div>
<div class="line"><a id="l00553" name="l00553"></a><span class="lineno">  553</span> </div>
<div class="line"><a id="l00593" name="l00593"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga8c9a44afb63e2137b7d5bbdf7c7e75da">  593</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#ga8c9a44afb63e2137b7d5bbdf7c7e75da">rom_flash_op</a>(<a class="code hl_struct" href="structcflash__flags.html">cflash_flags_t</a> flags, uintptr_t addr, uint32_t size_bytes, uint8_t *buf) {</div>
<div class="line"><a id="l00594" name="l00594"></a><span class="lineno">  594</span>    <span class="keywordflow">if</span> (!bootrom_try_acquire_lock(BOOTROM_LOCK_FLASH_OP))</div>
<div class="line"><a id="l00595" name="l00595"></a><span class="lineno">  595</span>        <span class="keywordflow">return</span> BOOTROM_ERROR_LOCK_REQUIRED;</div>
<div class="line"><a id="l00596" name="l00596"></a><span class="lineno">  596</span>    <span class="keywordtype">int</span> rc = 0;</div>
<div class="line"><a id="l00597" name="l00597"></a><span class="lineno">  597</span>    <a class="code hl_struct" href="structrom__helper__flash__op__params__t.html">rom_helper_flash_op_params_t</a> params = {</div>
<div class="line"><a id="l00598" name="l00598"></a><span class="lineno">  598</span>        .flags = flags,</div>
<div class="line"><a id="l00599" name="l00599"></a><span class="lineno">  599</span>        .addr = addr,</div>
<div class="line"><a id="l00600" name="l00600"></a><span class="lineno">  600</span>        .size_bytes = size_bytes,</div>
<div class="line"><a id="l00601" name="l00601"></a><span class="lineno">  601</span>        .buf = buf,</div>
<div class="line"><a id="l00602" name="l00602"></a><span class="lineno">  602</span>        .res = &amp;rc</div>
<div class="line"><a id="l00603" name="l00603"></a><span class="lineno">  603</span>    };</div>
<div class="line"><a id="l00604" name="l00604"></a><span class="lineno">  604</span>    <span class="keywordtype">int</span> flash_rc = <a class="code hl_function" href="group__pico__flash.html#ga679076dc10c5beb73d5f1abdb52d6735">flash_safe_execute</a>(rom_helper_flash_op, &amp;params, UINT32_MAX);</div>
<div class="line"><a id="l00605" name="l00605"></a><span class="lineno">  605</span>    bootrom_release_lock(BOOTROM_LOCK_FLASH_OP);</div>
<div class="line"><a id="l00606" name="l00606"></a><span class="lineno">  606</span>    <span class="keywordflow">if</span> (flash_rc != <a class="code hl_enumvalue" href="group__pico__base.html#ggaddcb20bc9a61ceff479aa87369a862aaa9b50bcb755cf2e8295de9ffa52b252fd">PICO_OK</a>) {</div>
<div class="line"><a id="l00607" name="l00607"></a><span class="lineno">  607</span>        <span class="keywordflow">return</span> flash_rc;</div>
<div class="line"><a id="l00608" name="l00608"></a><span class="lineno">  608</span>    } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00609" name="l00609"></a><span class="lineno">  609</span>        <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00610" name="l00610"></a><span class="lineno">  610</span>    }</div>
<div class="line"><a id="l00611" name="l00611"></a><span class="lineno">  611</span>}</div>
<div class="line"><a id="l00612" name="l00612"></a><span class="lineno">  612</span> </div>
<div class="line"><a id="l00637" name="l00637"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga8032648d0d33c7219a1f98bb4bc22c81">  637</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#ga8032648d0d33c7219a1f98bb4bc22c81">rom_func_otp_access</a>(uint8_t *buf, uint32_t buf_len, <a class="code hl_struct" href="structotp__cmd.html">otp_cmd_t</a> cmd) {</div>
<div class="line"><a id="l00638" name="l00638"></a><span class="lineno">  638</span>    rom_func_otp_access_fn func = (rom_func_otp_access_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_OTP_ACCESS);</div>
<div class="line"><a id="l00639" name="l00639"></a><span class="lineno">  639</span>    <span class="keywordflow">if</span> (!bootrom_try_acquire_lock(BOOTROM_LOCK_OTP))</div>
<div class="line"><a id="l00640" name="l00640"></a><span class="lineno">  640</span>        <span class="keywordflow">return</span> BOOTROM_ERROR_LOCK_REQUIRED;</div>
<div class="line"><a id="l00641" name="l00641"></a><span class="lineno">  641</span>    <span class="keywordtype">int</span> rc = func(buf, buf_len, cmd);</div>
<div class="line"><a id="l00642" name="l00642"></a><span class="lineno">  642</span>    bootrom_release_lock(BOOTROM_LOCK_OTP);</div>
<div class="line"><a id="l00643" name="l00643"></a><span class="lineno">  643</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00644" name="l00644"></a><span class="lineno">  644</span>}</div>
<div class="line"><a id="l00645" name="l00645"></a><span class="lineno">  645</span> </div>
<div class="line"><a id="l00674" name="l00674"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga307eb94ee1eecf5d7b089488420f7311">  674</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#ga307eb94ee1eecf5d7b089488420f7311">rom_get_partition_table_info</a>(uint32_t *out_buffer, uint32_t out_buffer_word_size, uint32_t partition_and_flags) {</div>
<div class="line"><a id="l00675" name="l00675"></a><span class="lineno">  675</span>    rom_get_partition_table_info_fn func = (rom_get_partition_table_info_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_GET_PARTITION_TABLE_INFO);</div>
<div class="line"><a id="l00676" name="l00676"></a><span class="lineno">  676</span>    <span class="keywordflow">if</span> (!bootrom_try_acquire_lock(BOOTROM_LOCK_SHA_256))</div>
<div class="line"><a id="l00677" name="l00677"></a><span class="lineno">  677</span>        <span class="keywordflow">return</span> BOOTROM_ERROR_LOCK_REQUIRED;</div>
<div class="line"><a id="l00678" name="l00678"></a><span class="lineno">  678</span>    <span class="keywordtype">int</span> rc = func(out_buffer, out_buffer_word_size, partition_and_flags);</div>
<div class="line"><a id="l00679" name="l00679"></a><span class="lineno">  679</span>    bootrom_release_lock(BOOTROM_LOCK_SHA_256);</div>
<div class="line"><a id="l00680" name="l00680"></a><span class="lineno">  680</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00681" name="l00681"></a><span class="lineno">  681</span>}</div>
<div class="line"><a id="l00682" name="l00682"></a><span class="lineno">  682</span> </div>
<div class="line"><a id="l00683" name="l00683"></a><span class="lineno">  683</span><span class="comment">// todo SECURE only</span></div>
<div class="line"><a id="l00699" name="l00699"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gafc3ac79dba27ea676b281106b84bbfaf">  699</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#gafc3ac79dba27ea676b281106b84bbfaf">rom_load_partition_table</a>(uint8_t *workarea_base, uint32_t workarea_size, <span class="keywordtype">bool</span> force_reload) {</div>
<div class="line"><a id="l00700" name="l00700"></a><span class="lineno">  700</span>    rom_load_partition_table_fn func = (rom_load_partition_table_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_LOAD_PARTITION_TABLE);</div>
<div class="line"><a id="l00701" name="l00701"></a><span class="lineno">  701</span>    <span class="keywordflow">if</span> (!bootrom_try_acquire_lock(BOOTROM_LOCK_SHA_256))</div>
<div class="line"><a id="l00702" name="l00702"></a><span class="lineno">  702</span>        <span class="keywordflow">return</span> BOOTROM_ERROR_LOCK_REQUIRED;</div>
<div class="line"><a id="l00703" name="l00703"></a><span class="lineno">  703</span>    <span class="keywordtype">int</span> rc = func(workarea_base, workarea_size, force_reload);</div>
<div class="line"><a id="l00704" name="l00704"></a><span class="lineno">  704</span>    bootrom_release_lock(BOOTROM_LOCK_SHA_256);</div>
<div class="line"><a id="l00705" name="l00705"></a><span class="lineno">  705</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00706" name="l00706"></a><span class="lineno">  706</span>}</div>
<div class="line"><a id="l00707" name="l00707"></a><span class="lineno">  707</span> </div>
<div class="line"><a id="l00708" name="l00708"></a><span class="lineno">  708</span><span class="comment">// todo SECURE only</span></div>
<div class="line"><a id="l00731" name="l00731"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga1763ac821dcd10d0a6e65cf1cdffb4b5">  731</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#ga1763ac821dcd10d0a6e65cf1cdffb4b5">rom_pick_ab_partition</a>(uint8_t *workarea_base, uint32_t workarea_size, uint partition_a_num, uint32_t flash_update_boot_window_base) {</div>
<div class="line"><a id="l00732" name="l00732"></a><span class="lineno">  732</span>    rom_pick_ab_partition_fn func = (rom_pick_ab_partition_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_PICK_AB_PARTITION);</div>
<div class="line"><a id="l00733" name="l00733"></a><span class="lineno">  733</span>    <span class="keywordflow">if</span> (!bootrom_try_acquire_lock(BOOTROM_LOCK_SHA_256))</div>
<div class="line"><a id="l00734" name="l00734"></a><span class="lineno">  734</span>        <span class="keywordflow">return</span> BOOTROM_ERROR_LOCK_REQUIRED;</div>
<div class="line"><a id="l00735" name="l00735"></a><span class="lineno">  735</span>    <span class="keywordtype">int</span> rc = func(workarea_base, workarea_size, partition_a_num, flash_update_boot_window_base);</div>
<div class="line"><a id="l00736" name="l00736"></a><span class="lineno">  736</span>    bootrom_release_lock(BOOTROM_LOCK_SHA_256);</div>
<div class="line"><a id="l00737" name="l00737"></a><span class="lineno">  737</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00738" name="l00738"></a><span class="lineno">  738</span>}</div>
<div class="line"><a id="l00739" name="l00739"></a><span class="lineno">  739</span> </div>
<div class="line"><a id="l00749" name="l00749"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gaa12306bf99c4bd77f8ad4416cf5afffa">  749</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#gaa12306bf99c4bd77f8ad4416cf5afffa">rom_get_b_partition</a>(uint pi_a) {</div>
<div class="line"><a id="l00750" name="l00750"></a><span class="lineno">  750</span>    rom_get_b_partition_fn func = (rom_get_b_partition_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_GET_B_PARTITION);</div>
<div class="line"><a id="l00751" name="l00751"></a><span class="lineno">  751</span>    <span class="keywordflow">return</span> func(pi_a);</div>
<div class="line"><a id="l00752" name="l00752"></a><span class="lineno">  752</span>}</div>
<div class="line"><a id="l00753" name="l00753"></a><span class="lineno">  753</span> </div>
<div class="line"><a id="l00754" name="l00754"></a><span class="lineno">  754</span><span class="comment">// todo SECURE only</span></div>
<div class="line"><a id="l00775" name="l00775"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gad19f4e80f36e015336ef33003d2f2982">  775</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#gad19f4e80f36e015336ef33003d2f2982">rom_get_uf2_target_partition</a>(uint8_t *workarea_base, uint32_t workarea_size, uint32_t family_id, <a class="code hl_struct" href="structresident__partition__t.html">resident_partition_t</a> *partition_out) {</div>
<div class="line"><a id="l00776" name="l00776"></a><span class="lineno">  776</span>    rom_get_uf2_target_partition_fn func = (rom_get_uf2_target_partition_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_GET_UF2_TARGET_PARTITION);</div>
<div class="line"><a id="l00777" name="l00777"></a><span class="lineno">  777</span>    <span class="keywordflow">if</span> (!bootrom_try_acquire_lock(BOOTROM_LOCK_SHA_256))</div>
<div class="line"><a id="l00778" name="l00778"></a><span class="lineno">  778</span>        <span class="keywordflow">return</span> BOOTROM_ERROR_LOCK_REQUIRED;</div>
<div class="line"><a id="l00779" name="l00779"></a><span class="lineno">  779</span>    <span class="keywordtype">int</span> rc = func(workarea_base, workarea_size, family_id, partition_out);</div>
<div class="line"><a id="l00780" name="l00780"></a><span class="lineno">  780</span>    bootrom_release_lock(BOOTROM_LOCK_SHA_256);</div>
<div class="line"><a id="l00781" name="l00781"></a><span class="lineno">  781</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00782" name="l00782"></a><span class="lineno">  782</span>}</div>
<div class="line"><a id="l00783" name="l00783"></a><span class="lineno">  783</span> </div>
<div class="line"><a id="l00796" name="l00796"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga6cd5c5ee439731dd80839d5f043c0c6d">  796</a></span><span class="keyword">static</span> <span class="keyword">inline</span> intptr_t <a class="code hl_function" href="group__pico__bootrom.html#ga6cd5c5ee439731dd80839d5f043c0c6d">rom_flash_runtime_to_storage_addr</a>(uintptr_t flash_runtime_addr) {</div>
<div class="line"><a id="l00797" name="l00797"></a><span class="lineno">  797</span>    rom_flash_runtime_to_storage_addr_fn func = (rom_flash_runtime_to_storage_addr_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_FLASH_RUNTIME_TO_STORAGE_ADDR);</div>
<div class="line"><a id="l00798" name="l00798"></a><span class="lineno">  798</span>    <span class="keywordflow">return</span> func(flash_runtime_addr);</div>
<div class="line"><a id="l00799" name="l00799"></a><span class="lineno">  799</span>}</div>
<div class="line"><a id="l00800" name="l00800"></a><span class="lineno">  800</span> </div>
<div class="line"><a id="l00801" name="l00801"></a><span class="lineno">  801</span><span class="comment">// todo SECURE only</span></div>
<div class="line"><a id="l00829" name="l00829"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gaf6ccde86cb9eaffb69667c36110ab318">  829</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#gaf6ccde86cb9eaffb69667c36110ab318">rom_chain_image</a>(uint8_t *workarea_base, uint32_t workarea_size, uint32_t region_base, uint32_t region_size) {</div>
<div class="line"><a id="l00830" name="l00830"></a><span class="lineno">  830</span>    rom_chain_image_fn func = (rom_chain_image_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_CHAIN_IMAGE);</div>
<div class="line"><a id="l00831" name="l00831"></a><span class="lineno">  831</span>    bootrom_release_lock(BOOTROM_LOCK_ENABLE);</div>
<div class="line"><a id="l00832" name="l00832"></a><span class="lineno">  832</span>    uint32_t interrupt_flags = <a class="code hl_function" href="group__hardware__sync.html#ga15ada9cfb92615e5bb05a29aa3fc7ad8">save_and_disable_interrupts</a>();</div>
<div class="line"><a id="l00833" name="l00833"></a><span class="lineno">  833</span>    <span class="keywordtype">int</span> rc = func(workarea_base, workarea_size, region_base, region_size);</div>
<div class="line"><a id="l00834" name="l00834"></a><span class="lineno">  834</span>    <a class="code hl_function" href="group__hardware__sync.html#ga4bb69d1717ab90105ea05b82291fc0c7">restore_interrupts_from_disabled</a>(interrupt_flags);</div>
<div class="line"><a id="l00835" name="l00835"></a><span class="lineno">  835</span>    bootrom_acquire_lock_blocking(BOOTROM_LOCK_ENABLE);</div>
<div class="line"><a id="l00836" name="l00836"></a><span class="lineno">  836</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00837" name="l00837"></a><span class="lineno">  837</span>}</div>
<div class="line"><a id="l00838" name="l00838"></a><span class="lineno">  838</span> </div>
<div class="line"><a id="l00839" name="l00839"></a><span class="lineno"><a class="line" href="structrom__helper__explicit__buy__params__t.html">  839</a></span><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a id="l00840" name="l00840"></a><span class="lineno">  840</span>    uint8_t *buffer;</div>
<div class="line"><a id="l00841" name="l00841"></a><span class="lineno">  841</span>    uint32_t buffer_size;</div>
<div class="line"><a id="l00842" name="l00842"></a><span class="lineno">  842</span>    <span class="keywordtype">int</span> *res;</div>
<div class="line"><a id="l00843" name="l00843"></a><span class="lineno">  843</span>} <a class="code hl_struct" href="structrom__helper__explicit__buy__params__t.html">rom_helper_explicit_buy_params_t</a>;</div>
<div class="line"><a id="l00844" name="l00844"></a><span class="lineno">  844</span> </div>
<div class="line"><a id="l00845" name="l00845"></a><span class="lineno">  845</span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> rom_helper_explicit_buy(<span class="keywordtype">void</span> *param) {</div>
<div class="line"><a id="l00846" name="l00846"></a><span class="lineno">  846</span>    <span class="keyword">const</span> <a class="code hl_struct" href="structrom__helper__explicit__buy__params__t.html">rom_helper_explicit_buy_params_t</a> *op = (<span class="keyword">const</span> <a class="code hl_struct" href="structrom__helper__explicit__buy__params__t.html">rom_helper_explicit_buy_params_t</a> *)param;</div>
<div class="line"><a id="l00847" name="l00847"></a><span class="lineno">  847</span>    rom_explicit_buy_fn func = (rom_explicit_buy_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_EXPLICIT_BUY);</div>
<div class="line"><a id="l00848" name="l00848"></a><span class="lineno">  848</span>    *(op-&gt;res) = func(op-&gt;buffer, op-&gt;buffer_size);</div>
<div class="line"><a id="l00849" name="l00849"></a><span class="lineno">  849</span>}</div>
<div class="line"><a id="l00850" name="l00850"></a><span class="lineno">  850</span> </div>
<div class="line"><a id="l00851" name="l00851"></a><span class="lineno">  851</span><span class="comment">// todo SECURE only</span></div>
<div class="line"><a id="l00877" name="l00877"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga3476920d3da9f3882e61eb9ba5ed83f5">  877</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#ga3476920d3da9f3882e61eb9ba5ed83f5">rom_explicit_buy</a>(uint8_t *buffer, uint32_t buffer_size) {</div>
<div class="line"><a id="l00878" name="l00878"></a><span class="lineno">  878</span>    <span class="keywordtype">int</span> rc = 0;</div>
<div class="line"><a id="l00879" name="l00879"></a><span class="lineno">  879</span>    <a class="code hl_struct" href="structrom__helper__explicit__buy__params__t.html">rom_helper_explicit_buy_params_t</a> params = {</div>
<div class="line"><a id="l00880" name="l00880"></a><span class="lineno">  880</span>        .buffer = buffer,</div>
<div class="line"><a id="l00881" name="l00881"></a><span class="lineno">  881</span>        .buffer_size = buffer_size,</div>
<div class="line"><a id="l00882" name="l00882"></a><span class="lineno">  882</span>        .res = &amp;rc</div>
<div class="line"><a id="l00883" name="l00883"></a><span class="lineno">  883</span>    };</div>
<div class="line"><a id="l00884" name="l00884"></a><span class="lineno">  884</span>    <span class="keywordtype">int</span> flash_rc = <a class="code hl_function" href="group__pico__flash.html#ga679076dc10c5beb73d5f1abdb52d6735">flash_safe_execute</a>(rom_helper_explicit_buy, &amp;params, UINT32_MAX);</div>
<div class="line"><a id="l00885" name="l00885"></a><span class="lineno">  885</span>    <span class="keywordflow">if</span> (flash_rc != <a class="code hl_enumvalue" href="group__pico__base.html#ggaddcb20bc9a61ceff479aa87369a862aaa9b50bcb755cf2e8295de9ffa52b252fd">PICO_OK</a>) {</div>
<div class="line"><a id="l00886" name="l00886"></a><span class="lineno">  886</span>        <span class="keywordflow">return</span> flash_rc;</div>
<div class="line"><a id="l00887" name="l00887"></a><span class="lineno">  887</span>    } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00888" name="l00888"></a><span class="lineno">  888</span>        <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l00889" name="l00889"></a><span class="lineno">  889</span>    }</div>
<div class="line"><a id="l00890" name="l00890"></a><span class="lineno">  890</span>}</div>
<div class="line"><a id="l00891" name="l00891"></a><span class="lineno">  891</span> </div>
<div class="line"><a id="l00892" name="l00892"></a><span class="lineno">  892</span><span class="preprocessor">#ifndef __riscv</span></div>
<div class="line"><a id="l00907" name="l00907"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gaef7eef3fc50ebb572864ce41b56f7ecf">  907</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#gaef7eef3fc50ebb572864ce41b56f7ecf">rom_set_ns_api_permission</a>(uint ns_api_num, <span class="keywordtype">bool</span> allowed) {</div>
<div class="line"><a id="l00908" name="l00908"></a><span class="lineno">  908</span>    rom_set_ns_api_permission_fn func = (rom_set_ns_api_permission_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_SET_NS_API_PERMISSION);</div>
<div class="line"><a id="l00909" name="l00909"></a><span class="lineno">  909</span>    <span class="keywordflow">return</span> func(ns_api_num, allowed);</div>
<div class="line"><a id="l00910" name="l00910"></a><span class="lineno">  910</span>}</div>
<div class="line"><a id="l00911" name="l00911"></a><span class="lineno">  911</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00912" name="l00912"></a><span class="lineno">  912</span> </div>
<div class="line"><a id="l00913" name="l00913"></a><span class="lineno">  913</span><span class="comment">// todo SECURE only</span></div>
<div class="line"><a id="l00933" name="l00933"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gab36e9c2507be4131612c44c967a8a9a3">  933</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span>* <a class="code hl_function" href="group__pico__bootrom.html#gab36e9c2507be4131612c44c967a8a9a3">rom_validate_ns_buffer</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *addr, uint32_t size, uint32_t write, uint32_t *ok) {</div>
<div class="line"><a id="l00934" name="l00934"></a><span class="lineno">  934</span>    rom_validate_ns_buffer_fn func = (rom_validate_ns_buffer_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_VALIDATE_NS_BUFFER);</div>
<div class="line"><a id="l00935" name="l00935"></a><span class="lineno">  935</span>    <span class="keywordflow">return</span> func(addr, size, write, ok);</div>
<div class="line"><a id="l00936" name="l00936"></a><span class="lineno">  936</span>}</div>
<div class="line"><a id="l00937" name="l00937"></a><span class="lineno">  937</span> </div>
<div class="line"><a id="l00952" name="l00952"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#gad23d5bfd10e8367b30b1cb6a5750ecc3">  952</a></span><span class="keyword">static</span> <span class="keyword">inline</span> intptr_t <a class="code hl_function" href="group__pico__bootrom.html#gad23d5bfd10e8367b30b1cb6a5750ecc3">rom_set_rom_callback</a>(uint callback_num, bootrom_api_callback_generic_t funcptr) {</div>
<div class="line"><a id="l00953" name="l00953"></a><span class="lineno">  953</span>    rom_set_rom_callback_fn func = (rom_set_rom_callback_fn) <a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_SET_ROM_CALLBACK);</div>
<div class="line"><a id="l00954" name="l00954"></a><span class="lineno">  954</span>    <span class="keywordflow">return</span> func(callback_num, funcptr);</div>
<div class="line"><a id="l00955" name="l00955"></a><span class="lineno">  955</span>}</div>
<div class="line"><a id="l00956" name="l00956"></a><span class="lineno">  956</span> </div>
<div class="line"><a id="l00957" name="l00957"></a><span class="lineno">  957</span><span class="preprocessor">#define BOOT_TYPE_NORMAL     0</span></div>
<div class="line"><a id="l00958" name="l00958"></a><span class="lineno">  958</span><span class="preprocessor">#define BOOT_TYPE_BOOTSEL    2</span></div>
<div class="line"><a id="l00959" name="l00959"></a><span class="lineno">  959</span><span class="preprocessor">#define BOOT_TYPE_RAM_IMAGE  3</span></div>
<div class="line"><a id="l00960" name="l00960"></a><span class="lineno">  960</span><span class="preprocessor">#define BOOT_TYPE_FLASH_UPDATE 4</span></div>
<div class="line"><a id="l00961" name="l00961"></a><span class="lineno">  961</span> </div>
<div class="line"><a id="l00962" name="l00962"></a><span class="lineno">  962</span><span class="comment">// values 8-15 are secure only</span></div>
<div class="line"><a id="l00963" name="l00963"></a><span class="lineno">  963</span><span class="preprocessor">#define BOOT_TYPE_PC_SP      0xd</span></div>
<div class="line"><a id="l00964" name="l00964"></a><span class="lineno">  964</span> </div>
<div class="line"><a id="l00965" name="l00965"></a><span class="lineno">  965</span><span class="comment">// ORed in if a bootloader chained into the image</span></div>
<div class="line"><a id="l00966" name="l00966"></a><span class="lineno">  966</span><span class="preprocessor">#define BOOT_TYPE_CHAINED_FLAG 0x80</span></div>
<div class="line"><a id="l00967" name="l00967"></a><span class="lineno">  967</span> </div>
<div class="line"><a id="l01000" name="l01000"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga00081f79b6a1002993347c2c105a0c87"> 1000</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#ga00081f79b6a1002993347c2c105a0c87">rom_get_sys_info</a>(uint32_t *out_buffer, uint32_t out_buffer_word_size, uint32_t flags) {</div>
<div class="line"><a id="l01001" name="l01001"></a><span class="lineno"> 1001</span>    rom_get_sys_info_fn func = (rom_get_sys_info_fn)<a class="code hl_function" href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a>(ROM_FUNC_GET_SYS_INFO);</div>
<div class="line"><a id="l01002" name="l01002"></a><span class="lineno"> 1002</span>    <span class="keywordflow">return</span> func(out_buffer, out_buffer_word_size, flags);</div>
<div class="line"><a id="l01003" name="l01003"></a><span class="lineno"> 1003</span>}</div>
<div class="line"><a id="l01004" name="l01004"></a><span class="lineno"> 1004</span> </div>
<div class="line"><a id="l01005" name="l01005"></a><span class="lineno"><a class="line" href="structboot__info__t.html"> 1005</a></span><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a id="l01006" name="l01006"></a><span class="lineno"> 1006</span>    <span class="keyword">union </span>{</div>
<div class="line"><a id="l01007" name="l01007"></a><span class="lineno"> 1007</span>        <span class="keyword">struct </span>__packed {</div>
<div class="line"><a id="l01008" name="l01008"></a><span class="lineno"> 1008</span>            int8_t diagnostic_partition_index; <span class="comment">// used BOOT_PARTITION constants</span></div>
<div class="line"><a id="l01009" name="l01009"></a><span class="lineno"> 1009</span>            uint8_t boot_type;</div>
<div class="line"><a id="l01010" name="l01010"></a><span class="lineno"> 1010</span>            int8_t partition;</div>
<div class="line"><a id="l01011" name="l01011"></a><span class="lineno"> 1011</span>            uint8_t tbyb_and_update_info;</div>
<div class="line"><a id="l01012" name="l01012"></a><span class="lineno"> 1012</span>        };</div>
<div class="line"><a id="l01013" name="l01013"></a><span class="lineno"> 1013</span>        uint32_t boot_word;</div>
<div class="line"><a id="l01014" name="l01014"></a><span class="lineno"> 1014</span>    };</div>
<div class="line"><a id="l01015" name="l01015"></a><span class="lineno"> 1015</span>    uint32_t boot_diagnostic;</div>
<div class="line"><a id="l01016" name="l01016"></a><span class="lineno"> 1016</span>    uint32_t reboot_params[2];</div>
<div class="line"><a id="l01017" name="l01017"></a><span class="lineno"> 1017</span>} <a class="code hl_struct" href="structboot__info__t.html">boot_info_t</a>;</div>
<div class="line"><a id="l01018" name="l01018"></a><span class="lineno"> 1018</span> </div>
<div class="line"><a id="l01019" name="l01019"></a><span class="lineno"> 1019</span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> rom_get_boot_info(<a class="code hl_struct" href="structboot__info__t.html">boot_info_t</a> *info) {</div>
<div class="line"><a id="l01020" name="l01020"></a><span class="lineno"> 1020</span>    uint32_t result[5];</div>
<div class="line"><a id="l01021" name="l01021"></a><span class="lineno"> 1021</span>    <span class="keywordtype">int</span> words_returned = <a class="code hl_function" href="group__pico__bootrom.html#ga00081f79b6a1002993347c2c105a0c87">rom_get_sys_info</a>(result, 5, SYS_INFO_BOOT_INFO);</div>
<div class="line"><a id="l01022" name="l01022"></a><span class="lineno"> 1022</span>    <span class="keywordflow">if</span> (words_returned == (<span class="keyword">sizeof</span>(result)/<span class="keyword">sizeof</span>(result[0])) &amp;&amp; result[0] == SYS_INFO_BOOT_INFO) {</div>
<div class="line"><a id="l01023" name="l01023"></a><span class="lineno"> 1023</span>        memcpy(info, &amp;result[1], <span class="keyword">sizeof</span>(<a class="code hl_struct" href="structboot__info__t.html">boot_info_t</a>));</div>
<div class="line"><a id="l01024" name="l01024"></a><span class="lineno"> 1024</span>        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a id="l01025" name="l01025"></a><span class="lineno"> 1025</span>    } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l01026" name="l01026"></a><span class="lineno"> 1026</span>        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l01027" name="l01027"></a><span class="lineno"> 1027</span>    }</div>
<div class="line"><a id="l01028" name="l01028"></a><span class="lineno"> 1028</span>}</div>
<div class="line"><a id="l01029" name="l01029"></a><span class="lineno"> 1029</span> </div>
<div class="line"><a id="l01030" name="l01030"></a><span class="lineno"> 1030</span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> rom_get_last_boot_type_with_chained_flag(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l01031" name="l01031"></a><span class="lineno"> 1031</span>    uint32_t result[5];</div>
<div class="line"><a id="l01032" name="l01032"></a><span class="lineno"> 1032</span>    <span class="keywordtype">int</span> words_returned = <a class="code hl_function" href="group__pico__bootrom.html#ga00081f79b6a1002993347c2c105a0c87">rom_get_sys_info</a>(result, 5, SYS_INFO_BOOT_INFO);</div>
<div class="line"><a id="l01033" name="l01033"></a><span class="lineno"> 1033</span>    <span class="keywordflow">if</span> (words_returned == <a class="code hl_define" href="group__pico__platform.html#ga29022c0c92a05cf88ca5046c59d6f629">count_of</a>(result) &amp;&amp; result[0] == SYS_INFO_BOOT_INFO) {</div>
<div class="line"><a id="l01034" name="l01034"></a><span class="lineno"> 1034</span>        <span class="comment">// todo use struct</span></div>
<div class="line"><a id="l01035" name="l01035"></a><span class="lineno"> 1035</span>        <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)((result[1] &amp; 0xff00u) &gt;&gt; 8);</div>
<div class="line"><a id="l01036" name="l01036"></a><span class="lineno"> 1036</span>    } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l01037" name="l01037"></a><span class="lineno"> 1037</span>        <span class="keywordflow">return</span> <a class="code hl_enumvalue" href="group__pico__base.html#ggaddcb20bc9a61ceff479aa87369a862aaacf8e80b0efb54177bb4c4e6e7ed5141c">PICO_ERROR_INVALID_DATA</a>;</div>
<div class="line"><a id="l01038" name="l01038"></a><span class="lineno"> 1038</span>    }</div>
<div class="line"><a id="l01039" name="l01039"></a><span class="lineno"> 1039</span>}</div>
<div class="line"><a id="l01040" name="l01040"></a><span class="lineno"> 1040</span> </div>
<div class="line"><a id="l01041" name="l01041"></a><span class="lineno"> 1041</span><span class="comment">// BOOT_TYPE_NORMAL       0x0</span></div>
<div class="line"><a id="l01042" name="l01042"></a><span class="lineno"> 1042</span><span class="comment">// BOOT_TYPE_BOOTSEL      0x2</span></div>
<div class="line"><a id="l01043" name="l01043"></a><span class="lineno"> 1043</span><span class="comment">// BOOT_TYPE_RAM_IMAGE    0x3</span></div>
<div class="line"><a id="l01044" name="l01044"></a><span class="lineno"> 1044</span><span class="comment">// BOOT_TYPE_FLASH_UPDATE 0x4</span></div>
<div class="line"><a id="l01045" name="l01045"></a><span class="lineno"> 1045</span><span class="comment">// BOOT_TYPE_PC_SP        0xd</span></div>
<div class="line"><a id="l01046" name="l01046"></a><span class="lineno"> 1046</span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> rom_get_last_boot_type(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l01047" name="l01047"></a><span class="lineno"> 1047</span>    <span class="keywordtype">int</span> rc = rom_get_last_boot_type_with_chained_flag();</div>
<div class="line"><a id="l01048" name="l01048"></a><span class="lineno"> 1048</span>    <span class="keywordflow">if</span> (rc &gt;= 0) rc &amp;= ~BOOT_TYPE_CHAINED_FLAG;</div>
<div class="line"><a id="l01049" name="l01049"></a><span class="lineno"> 1049</span>    <span class="keywordflow">return</span> rc;</div>
<div class="line"><a id="l01050" name="l01050"></a><span class="lineno"> 1050</span>}</div>
<div class="line"><a id="l01051" name="l01051"></a><span class="lineno"> 1051</span> </div>
<div class="line"><a id="l01066" name="l01066"></a><span class="lineno"><a class="line" href="group__pico__bootrom.html#ga17b99a409a7c1d595c202d0fa0d98c6e"> 1066</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__bootrom.html#ga17b99a409a7c1d595c202d0fa0d98c6e">rom_add_flash_runtime_partition</a>(uint32_t start_offset, uint32_t size, uint32_t permissions);</div>
<div class="line"><a id="l01067" name="l01067"></a><span class="lineno"> 1067</span> </div>
<div class="line"><a id="l01068" name="l01068"></a><span class="lineno"> 1068</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l01069" name="l01069"></a><span class="lineno"> 1069</span> </div>
<div class="line"><a id="l01070" name="l01070"></a><span class="lineno"> 1070</span><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a id="l01071" name="l01071"></a><span class="lineno"> 1071</span>}</div>
<div class="line"><a id="l01072" name="l01072"></a><span class="lineno"> 1072</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l01073" name="l01073"></a><span class="lineno"> 1073</span> </div>
<div class="line"><a id="l01074" name="l01074"></a><span class="lineno"> 1074</span><span class="preprocessor">#endif </span><span class="comment">// !__ASSEMBLER__</span></div>
<div class="line"><a id="l01075" name="l01075"></a><span class="lineno"> 1075</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="agroup__hardware__sync_html_ga15ada9cfb92615e5bb05a29aa3fc7ad8"><div class="ttname"><a href="group__hardware__sync.html#ga15ada9cfb92615e5bb05a29aa3fc7ad8">save_and_disable_interrupts</a></div><div class="ttdeci">static __force_inline uint32_t save_and_disable_interrupts(void)</div><div class="ttdoc">Save and disable interrupts.</div><div class="ttdef"><b>Definition:</b> sync.h:206</div></div>
<div class="ttc" id="agroup__hardware__sync_html_ga4bb69d1717ab90105ea05b82291fc0c7"><div class="ttname"><a href="group__hardware__sync.html#ga4bb69d1717ab90105ea05b82291fc0c7">restore_interrupts_from_disabled</a></div><div class="ttdeci">static __force_inline void restore_interrupts_from_disabled(uint32_t status)</div><div class="ttdoc">Restore interrupts to a specified state with restricted transitions.</div><div class="ttdef"><b>Definition:</b> sync.h:249</div></div>
<div class="ttc" id="agroup__pico__base_html_ggaddcb20bc9a61ceff479aa87369a862aaa9b50bcb755cf2e8295de9ffa52b252fd"><div class="ttname"><a href="group__pico__base.html#ggaddcb20bc9a61ceff479aa87369a862aaa9b50bcb755cf2e8295de9ffa52b252fd">PICO_OK</a></div><div class="ttdeci">@ PICO_OK</div><div class="ttdoc">No error; the operation succeeded.</div><div class="ttdef"><b>Definition:</b> error.h:23</div></div>
<div class="ttc" id="agroup__pico__base_html_ggaddcb20bc9a61ceff479aa87369a862aaacf8e80b0efb54177bb4c4e6e7ed5141c"><div class="ttname"><a href="group__pico__base.html#ggaddcb20bc9a61ceff479aa87369a862aaacf8e80b0efb54177bb4c4e6e7ed5141c">PICO_ERROR_INVALID_DATA</a></div><div class="ttdeci">@ PICO_ERROR_INVALID_DATA</div><div class="ttdoc">A data structure failed to validate.</div><div class="ttdef"><b>Definition:</b> error.h:40</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga00081f79b6a1002993347c2c105a0c87"><div class="ttname"><a href="group__pico__bootrom.html#ga00081f79b6a1002993347c2c105a0c87">rom_get_sys_info</a></div><div class="ttdeci">static int rom_get_sys_info(uint32_t *out_buffer, uint32_t out_buffer_word_size, uint32_t flags)</div><div class="ttdoc">Get system information.</div><div class="ttdef"><b>Definition:</b> bootrom.h:1000</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga15e12479af4b4618e254065371779e1e"><div class="ttname"><a href="group__pico__bootrom.html#ga15e12479af4b4618e254065371779e1e">rom_flash_flush_cache</a></div><div class="ttdeci">static void rom_flash_flush_cache(void)</div><div class="ttdoc">Flush the XIP cache.</div><div class="ttdef"><b>Definition:</b> bootrom.h:385</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga1763ac821dcd10d0a6e65cf1cdffb4b5"><div class="ttname"><a href="group__pico__bootrom.html#ga1763ac821dcd10d0a6e65cf1cdffb4b5">rom_pick_ab_partition</a></div><div class="ttdeci">static int rom_pick_ab_partition(uint8_t *workarea_base, uint32_t workarea_size, uint partition_a_num, uint32_t flash_update_boot_window_base)</div><div class="ttdoc">Pick a partition from an A/B pair.</div><div class="ttdef"><b>Definition:</b> bootrom.h:731</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga17b99a409a7c1d595c202d0fa0d98c6e"><div class="ttname"><a href="group__pico__bootrom.html#ga17b99a409a7c1d595c202d0fa0d98c6e">rom_add_flash_runtime_partition</a></div><div class="ttdeci">int rom_add_flash_runtime_partition(uint32_t start_offset, uint32_t size, uint32_t permissions)</div><div class="ttdoc">Add a runtime partition to the partition table to specify flash permissions.</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga1bbe1c1df02daaa7b68a0c95fb9dc545"><div class="ttname"><a href="group__pico__bootrom.html#ga1bbe1c1df02daaa7b68a0c95fb9dc545">rom_reset_usb_boot</a></div><div class="ttdeci">void rom_reset_usb_boot(uint32_t usb_activity_gpio_pin_mask, uint32_t disable_interface_mask)</div><div class="ttdoc">Reboot the device into BOOTSEL mode.</div><div class="ttdef"><b>Definition:</b> bootrom.c:48</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga2b6dcf9d9c60d54a222f7c259c76b4b4"><div class="ttname"><a href="group__pico__bootrom.html#ga2b6dcf9d9c60d54a222f7c259c76b4b4">rom_table_code</a></div><div class="ttdeci">static uint32_t rom_table_code(uint8_t c1, uint8_t c2)</div><div class="ttdoc">Return a bootrom lookup code based on two ASCII characters.</div><div class="ttdef"><b>Definition:</b> bootrom.h:120</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga307eb94ee1eecf5d7b089488420f7311"><div class="ttname"><a href="group__pico__bootrom.html#ga307eb94ee1eecf5d7b089488420f7311">rom_get_partition_table_info</a></div><div class="ttdeci">static int rom_get_partition_table_info(uint32_t *out_buffer, uint32_t out_buffer_word_size, uint32_t partition_and_flags)</div><div class="ttdoc">Fills a buffer with information from the partition table.</div><div class="ttdef"><b>Definition:</b> bootrom.h:674</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga31965209f0ddaeaecaeb3c516abda04d"><div class="ttname"><a href="group__pico__bootrom.html#ga31965209f0ddaeaecaeb3c516abda04d">rom_funcs_lookup</a></div><div class="ttdeci">bool rom_funcs_lookup(uint32_t *table, unsigned int count)</div><div class="ttdoc">Helper function to lookup the addresses of multiple bootrom functions.</div><div class="ttdef"><b>Definition:</b> bootrom.c:38</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga3476920d3da9f3882e61eb9ba5ed83f5"><div class="ttname"><a href="group__pico__bootrom.html#ga3476920d3da9f3882e61eb9ba5ed83f5">rom_explicit_buy</a></div><div class="ttdeci">static int rom_explicit_buy(uint8_t *buffer, uint32_t buffer_size)</div><div class="ttdoc">Buy an image.</div><div class="ttdef"><b>Definition:</b> bootrom.h:877</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga3ba1206778b333958c0dae5582d53bc3"><div class="ttname"><a href="group__pico__bootrom.html#ga3ba1206778b333958c0dae5582d53bc3">rom_connect_internal_flash</a></div><div class="ttdeci">static void rom_connect_internal_flash(void)</div><div class="ttdoc">Connect the SSI/QMI to the QSPI pads.</div><div class="ttdef"><b>Definition:</b> bootrom.h:271</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga41206eddaf67511768746b947b9c47f6"><div class="ttname"><a href="group__pico__bootrom.html#ga41206eddaf67511768746b947b9c47f6">rom_flash_exit_xip</a></div><div class="ttdeci">static void rom_flash_exit_xip(void)</div><div class="ttdoc">Return the QSPI device from its XIP state to a serial command state.</div><div class="ttdef"><b>Definition:</b> bootrom.h:302</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga44ddf78266c92f7a486712b87a695b45"><div class="ttname"><a href="group__pico__bootrom.html#ga44ddf78266c92f7a486712b87a695b45">rom_flash_enter_cmd_xip</a></div><div class="ttdeci">static void rom_flash_enter_cmd_xip(void)</div><div class="ttdoc">Configure the SSI/QMI with a standard command.</div><div class="ttdef"><b>Definition:</b> bootrom.h:401</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga5067c3bfdb2dc2a08b6e84b40281cabd"><div class="ttname"><a href="group__pico__bootrom.html#ga5067c3bfdb2dc2a08b6e84b40281cabd">rom_bootrom_state_reset</a></div><div class="ttdeci">static void rom_bootrom_state_reset(uint32_t flags)</div><div class="ttdoc">Reset bootrom state.</div><div class="ttdef"><b>Definition:</b> bootrom.h:507</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga5b3c93cbab0054e9938f2aca7261a73e"><div class="ttname"><a href="group__pico__bootrom.html#ga5b3c93cbab0054e9938f2aca7261a73e">ROM_TABLE_CODE</a></div><div class="ttdeci">#define ROM_TABLE_CODE(c1, c2)</div><div class="ttdoc">Return a bootrom lookup code based on two ASCII characters.</div><div class="ttdef"><b>Definition:</b> bootrom_constants.h:155</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga6990622d9a728e7e35f34c9c76fc11aa"><div class="ttname"><a href="group__pico__bootrom.html#ga6990622d9a728e7e35f34c9c76fc11aa">rom_flash_reset_address_trans</a></div><div class="ttdeci">static void rom_flash_reset_address_trans(void)</div><div class="ttdoc">Reset address translation.</div><div class="ttdef"><b>Definition:</b> bootrom.h:520</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga6cd5c5ee439731dd80839d5f043c0c6d"><div class="ttname"><a href="group__pico__bootrom.html#ga6cd5c5ee439731dd80839d5f043c0c6d">rom_flash_runtime_to_storage_addr</a></div><div class="ttdeci">static intptr_t rom_flash_runtime_to_storage_addr(uintptr_t flash_runtime_addr)</div><div class="ttdoc">Translate runtime to storage address.</div><div class="ttdef"><b>Definition:</b> bootrom.h:796</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga7fd2af8eea3dbd7bc76ed3306186ccef"><div class="ttname"><a href="group__pico__bootrom.html#ga7fd2af8eea3dbd7bc76ed3306186ccef">rom_flash_range_program</a></div><div class="ttdeci">static void rom_flash_range_program(uint32_t addr, const uint8_t *data, size_t count)</div><div class="ttdoc">Program bytes in flash.</div><div class="ttdef"><b>Definition:</b> bootrom.h:363</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga8032648d0d33c7219a1f98bb4bc22c81"><div class="ttname"><a href="group__pico__bootrom.html#ga8032648d0d33c7219a1f98bb4bc22c81">rom_func_otp_access</a></div><div class="ttdeci">static int rom_func_otp_access(uint8_t *buf, uint32_t buf_len, otp_cmd_t cmd)</div><div class="ttdoc">Writes data from a buffer into OTP, or reads data from OTP into a buffer.</div><div class="ttdef"><b>Definition:</b> bootrom.h:637</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga8c9a44afb63e2137b7d5bbdf7c7e75da"><div class="ttname"><a href="group__pico__bootrom.html#ga8c9a44afb63e2137b7d5bbdf7c7e75da">rom_flash_op</a></div><div class="ttdeci">static int rom_flash_op(cflash_flags_t flags, uintptr_t addr, uint32_t size_bytes, uint8_t *buf)</div><div class="ttdoc">Perform a flash read, erase, or program operation.</div><div class="ttdef"><b>Definition:</b> bootrom.h:593</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_ga8f4e326502015aa4f4624251df366268"><div class="ttname"><a href="group__pico__bootrom.html#ga8f4e326502015aa4f4624251df366268">rom_func_lookup_inline</a></div><div class="ttdeci">static __force_inline void * rom_func_lookup_inline(uint32_t code)</div><div class="ttdoc">Lookup a bootrom function by code. This method is forcibly inlined into the caller for FLASH/RAM sens...</div><div class="ttdef"><b>Definition:</b> bootrom.h:193</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gaa12306bf99c4bd77f8ad4416cf5afffa"><div class="ttname"><a href="group__pico__bootrom.html#gaa12306bf99c4bd77f8ad4416cf5afffa">rom_get_b_partition</a></div><div class="ttdeci">static int rom_get_b_partition(uint pi_a)</div><div class="ttdoc">Get B partition.</div><div class="ttdef"><b>Definition:</b> bootrom.h:749</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gaaaf61234f389da6444b6479f29616d7d"><div class="ttname"><a href="group__pico__bootrom.html#gaaaf61234f389da6444b6479f29616d7d">rom_func_lookup</a></div><div class="ttdeci">void * rom_func_lookup(uint32_t code)</div><div class="ttdoc">Lookup a bootrom function by its code.</div><div class="ttdef"><b>Definition:</b> bootrom.c:13</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gab36e9c2507be4131612c44c967a8a9a3"><div class="ttname"><a href="group__pico__bootrom.html#gab36e9c2507be4131612c44c967a8a9a3">rom_validate_ns_buffer</a></div><div class="ttdeci">static void * rom_validate_ns_buffer(const void *addr, uint32_t size, uint32_t write, uint32_t *ok)</div><div class="ttdoc">Validate NS Buffer.</div><div class="ttdef"><b>Definition:</b> bootrom.h:933</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gab82d162f5e7bc5287d81ac4127e37541"><div class="ttname"><a href="group__pico__bootrom.html#gab82d162f5e7bc5287d81ac4127e37541">rom_flash_select_xip_read_mode</a></div><div class="ttdeci">static void rom_flash_select_xip_read_mode(bootrom_xip_mode_t mode, uint8_t clkdiv)</div><div class="ttdoc">Configure QMI in a XIP read mode.</div><div class="ttdef"><b>Definition:</b> bootrom.h:535</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gad19f4e80f36e015336ef33003d2f2982"><div class="ttname"><a href="group__pico__bootrom.html#gad19f4e80f36e015336ef33003d2f2982">rom_get_uf2_target_partition</a></div><div class="ttdeci">static int rom_get_uf2_target_partition(uint8_t *workarea_base, uint32_t workarea_size, uint32_t family_id, resident_partition_t *partition_out)</div><div class="ttdoc">Get UF2 Target Partition.</div><div class="ttdef"><b>Definition:</b> bootrom.h:775</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gad23d5bfd10e8367b30b1cb6a5750ecc3"><div class="ttname"><a href="group__pico__bootrom.html#gad23d5bfd10e8367b30b1cb6a5750ecc3">rom_set_rom_callback</a></div><div class="ttdeci">static intptr_t rom_set_rom_callback(uint callback_num, bootrom_api_callback_generic_t funcptr)</div><div class="ttdoc">Set ROM callback function.</div><div class="ttdef"><b>Definition:</b> bootrom.h:952</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gad2a854a04f7007e9e5efa67fe8887cd7"><div class="ttname"><a href="group__pico__bootrom.html#gad2a854a04f7007e9e5efa67fe8887cd7">rom_flash_range_erase</a></div><div class="ttdeci">static void rom_flash_range_erase(uint32_t addr, size_t count, uint32_t block_size, uint8_t block_cmd)</div><div class="ttdoc">Erase bytes in flash.</div><div class="ttdef"><b>Definition:</b> bootrom.h:338</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gad3e66e7bcbf0448a0a63cf37dfb4b53c"><div class="ttname"><a href="group__pico__bootrom.html#gad3e66e7bcbf0448a0a63cf37dfb4b53c">rom_data_lookup</a></div><div class="ttdeci">void * rom_data_lookup(uint32_t code)</div><div class="ttdoc">Lookup a bootrom data address by its code.</div><div class="ttdef"><b>Definition:</b> bootrom.c:20</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gadbb1f51a04fd0c27513468996d24f3ce"><div class="ttname"><a href="group__pico__bootrom.html#gadbb1f51a04fd0c27513468996d24f3ce">rom_reboot</a></div><div class="ttdeci">static int rom_reboot(uint32_t flags, uint32_t delay_ms, uint32_t p0, uint32_t p1)</div><div class="ttdoc">Reboot using the watchdog.</div><div class="ttdef"><b>Definition:</b> bootrom.h:476</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gaef5ef9e40f0b55d3e9d6b4ddd6c1b8ee"><div class="ttname"><a href="group__pico__bootrom.html#gaef5ef9e40f0b55d3e9d6b4ddd6c1b8ee">rom_reset_usb_boot_extra</a></div><div class="ttdeci">void rom_reset_usb_boot_extra(int usb_activity_gpio_pin, uint32_t disable_interface_mask, bool usb_activity_gpio_pin_active_low)</div><div class="ttdoc">Reboot the device into BOOTSEL mode.</div><div class="ttdef"><b>Definition:</b> bootrom.c:66</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gaef7eef3fc50ebb572864ce41b56f7ecf"><div class="ttname"><a href="group__pico__bootrom.html#gaef7eef3fc50ebb572864ce41b56f7ecf">rom_set_ns_api_permission</a></div><div class="ttdeci">static int rom_set_ns_api_permission(uint ns_api_num, bool allowed)</div><div class="ttdoc">Set NS API Permission.</div><div class="ttdef"><b>Definition:</b> bootrom.h:907</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gaf6ccde86cb9eaffb69667c36110ab318"><div class="ttname"><a href="group__pico__bootrom.html#gaf6ccde86cb9eaffb69667c36110ab318">rom_chain_image</a></div><div class="ttdeci">static int rom_chain_image(uint8_t *workarea_base, uint32_t workarea_size, uint32_t region_base, uint32_t region_size)</div><div class="ttdoc">Chain into a launchable image.</div><div class="ttdef"><b>Definition:</b> bootrom.h:829</div></div>
<div class="ttc" id="agroup__pico__bootrom_html_gafc3ac79dba27ea676b281106b84bbfaf"><div class="ttname"><a href="group__pico__bootrom.html#gafc3ac79dba27ea676b281106b84bbfaf">rom_load_partition_table</a></div><div class="ttdeci">static int rom_load_partition_table(uint8_t *workarea_base, uint32_t workarea_size, bool force_reload)</div><div class="ttdoc">Loads the current partition table from flash, if present.</div><div class="ttdef"><b>Definition:</b> bootrom.h:699</div></div>
<div class="ttc" id="agroup__pico__flash_html_ga679076dc10c5beb73d5f1abdb52d6735"><div class="ttname"><a href="group__pico__flash.html#ga679076dc10c5beb73d5f1abdb52d6735">flash_safe_execute</a></div><div class="ttdeci">int flash_safe_execute(void(*func)(void *), void *param, uint32_t enter_exit_timeout_ms)</div><div class="ttdoc">Execute a function with IRQs disabled and with the other core also not executing/reading flash.</div><div class="ttdef"><b>Definition:</b> flash.c:75</div></div>
<div class="ttc" id="agroup__pico__platform_html_ga23eadd8d1642fb8fe4600708c36e116a"><div class="ttname"><a href="group__pico__platform.html#ga23eadd8d1642fb8fe4600708c36e116a">__force_inline</a></div><div class="ttdeci">#define __force_inline</div><div class="ttdoc">Attribute to force inlining of a function regardless of optimization level.</div><div class="ttdef"><b>Definition:</b> compiler.h:125</div></div>
<div class="ttc" id="agroup__pico__platform_html_ga29022c0c92a05cf88ca5046c59d6f629"><div class="ttname"><a href="group__pico__platform.html#ga29022c0c92a05cf88ca5046c59d6f629">count_of</a></div><div class="ttdeci">#define count_of(a)</div><div class="ttdoc">Macro to determine the number of elements in an array.</div><div class="ttdef"><b>Definition:</b> compiler.h:132</div></div>
<div class="ttc" id="agroup__pico__platform_html_ga66edd7569f5a42b0a2da43a5926cf064"><div class="ttname"><a href="group__pico__platform.html#ga66edd7569f5a42b0a2da43a5926cf064">pico_processor_state_is_nonsecure</a></div><div class="ttdeci">static __force_inline bool pico_processor_state_is_nonsecure(void)</div><div class="ttdoc">Return true if executing in the NonSecure state (Arm-only)</div><div class="ttdef"><b>Definition:</b> platform.h:199</div></div>
<div class="ttc" id="apico_8h_html"><div class="ttname"><a href="pico_8h.html">pico.h</a></div></div>
<div class="ttc" id="apico__flash_2include_2pico_2flash_8h_html"><div class="ttname"><a href="pico__flash_2include_2pico_2flash_8h.html">flash.h</a></div></div>
<div class="ttc" id="astructboot__info__t_html"><div class="ttname"><a href="structboot__info__t.html">boot_info_t</a></div><div class="ttdef"><b>Definition:</b> bootrom.h:1005</div></div>
<div class="ttc" id="astructcflash__flags_html"><div class="ttname"><a href="structcflash__flags.html">cflash_flags</a></div><div class="ttdef"><b>Definition:</b> bootrom_constants.h:307</div></div>
<div class="ttc" id="astructotp__cmd_html"><div class="ttname"><a href="structotp__cmd.html">otp_cmd</a></div><div class="ttdef"><b>Definition:</b> bootrom_constants.h:275</div></div>
<div class="ttc" id="astructresident__partition__t_html"><div class="ttname"><a href="structresident__partition__t.html">resident_partition_t</a></div><div class="ttdef"><b>Definition:</b> bootrom_constants.h:269</div></div>
<div class="ttc" id="astructrom__helper__explicit__buy__params__t_html"><div class="ttname"><a href="structrom__helper__explicit__buy__params__t.html">rom_helper_explicit_buy_params_t</a></div><div class="ttdef"><b>Definition:</b> bootrom.h:839</div></div>
<div class="ttc" id="astructrom__helper__flash__op__params__t_html"><div class="ttname"><a href="structrom__helper__flash__op__params__t.html">rom_helper_flash_op_params_t</a></div><div class="ttdef"><b>Definition:</b> bootrom.h:540</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->

	<script src="main.js"></script>
</body>
</html>